package it.ionize;

import java.util.List;

import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import net.miginfocom.swing.MigLayout;
import net.sourceforge.squirrel_sql.client.IApplication;

import javax.swing.JButton;

public class BlobExportPanel extends JPanel {
	private JTextField textField_1;


	public BlobExportPanel() {
		this(null,null,null,"");
	}
	/**
	 * Create the panel.
	 */
	public BlobExportPanel(List<String> blobFields, List<String> allFields,IApplication app,String sql) {
//		setLayout(new MigLayout("", "[511px]", "[54px][145px]"));
		setLayout(new MigLayout("wrap 3", "[grow]", "[][][][][][][]"));
		
		BlobExtractorLogic logic =new BlobExtractorLogic(blobFields, allFields,app,sql);

		
		JLabel lblSelectLobField = new JLabel("Select LOB field to export");
		add(lblSelectLobField, "cell 0 0,alignx center");
		
		JComboBox comboBox = new JComboBox();
		logic.setBlobFieldsComboBox(comboBox);
		add(comboBox, "cell 0 1,growx");
		
		
		JLabel lblSelectFilenamePattern = new JLabel("Select filename pattern");
		add(lblSelectFilenamePattern, "cell 0 2");
		
		JPanel panel = new JPanel();
		add(panel, "cell 0 3,grow");
		panel.setLayout(new MigLayout("", "[][][]", "[]"));
		
		JComboBox comboBox_1 = new JComboBox();
		logic.setOutputFormatComboBox1(comboBox_1);
		panel.add(comboBox_1, "flowx,cell 0 0");
		

		JComboBox comboBox_2 = new JComboBox();
		logic.setOutputFormatComboBox2(comboBox_2);
		panel.add(comboBox_2, "cell 1 0");
		

		JTextField textField = new JTextField();
		logic.setOutputFormatText(textField);
		panel.add(textField, "cell 2 0");
		textField.setColumns(20);
		
		JLabel lblSelectOutputFolder = new JLabel("Select output folder");
		add(lblSelectOutputFolder, "cell 0 4");
		
		JPanel panel_1 = new JPanel();
		add(panel_1, "cell 0 5,grow");
		panel_1.setLayout(new MigLayout("", "[grow]", "[]"));
		
		textField_1 = new JTextField();
		logic.setOutputPathText(textField_1);
		panel_1.add(textField_1, "flowx,cell 0 0,growx");
		textField_1.setColumns(10);
		
		JButton btnNewButton = new JButton("Select");
		logic.setOutputPathButton(btnNewButton);
		panel_1.add(btnNewButton, "cell 0 0");
		
		JPanel panel_2 = new JPanel();
		add(panel_2, "cell 0 6,grow");
		panel_2.setLayout(new MigLayout("", "[grow]", "[]"));
		
		JButton btnNewButton_1 = new JButton("Extract");
		logic.setExportButton(btnNewButton_1);
		panel_2.add(btnNewButton_1, "cell 0 0, growx");
		
		
//		JFileChooser fc = new JFileChooser();
//		fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

		logic.initComponents();
		
	}

}
